{template 'public/header'}

{template 'public/comhead'}
<link rel="stylesheet" type="text/css" href="../addons/zh_gjhdbm/template/public/ygcsslist.css">

<ul class="nav nav-tabs">
  <span class="ygxian"></span>
  <div class="ygdangq">当前位置:</div>
  <li  {if $type=='all'} class="active" {/if}><a href="{php echo $this->createWebUrl('sponsor',array('type'=>all));}">活动管理</a></li>
 
</ul>
<div class="row ygrow">
  <div class="col-lg-12">
    <form action="" method="get" class="col-md-6">
      <input type="hidden" name="c" value="site" />
      <input type="hidden" name="a" value="entry" />
      <input type="hidden" name="m" value="zh_gjhdbm" />
      <input type="hidden" name="do" value="sponsoractivity" />
       <input type="hidden" name="id" value="{$user_id}" />
      <div class="input-group" style="width: 300px">
        <input type="text" name="keywords" class="form-control" value="{$_GPC['keywords']}" placeholder="请输入标题">
        <span class="input-group-btn">
          <input type="submit" class="btn btn-default" name="submit" value="查找"/>
        </span>
      </div>
      <input type="hidden" name="token" value="{$_W['token']}"/>
    </form>
  </div><!-- /.col-lg-6 -->
</div>  
<div class="main">
  <div class="panel panel-default">
    <div class="panel-heading">
      活动管理
    </div>
    <div class="panel-body" style="padding: 0px 15px;">
      <div class="row">
        <table class="yg5_tabel col-md-12">
          <tr class="yg5_tr1">
           <td class="store_td1">活动标题</td>
           <td>活动分类</td>
           <td>活动城市</td>                       
           <td>主办方</td>
           <td>联系电话</td>
           <!--  <td>活动开始时间</td> -->
            <td>已购票数</td>
         <!--    <td>已卖金额</td> -->
            <td>排序</td>     
           <td>状态</td>
           <td>发布时间</td>
           <td>操作</td>
         </tr>
         {loop $list $key $item}
         <tr class="yg5_tr2">
          <td class="store_td1">
          <p>{$item['title']}</p>
          {if $item['start_time']> time()} <span class="label storered">未开始</span>
          {elseif $item['start_time']< time()&&$item['end_time']>time()} <span class="label storeblue">进行中</span>
          {else}<span class="label storegrey">已结束</span>{/if}</td>
          <td>{$item['type_name']}</td>
          <td>{$item['cityname']}</td>
           <td>{$item['sponsor']}</td>
        
       
          <td>{$item['link_tel']}</td>             
        <!--   <td>{php echo date("Y-m-d H:i:s",$item['start_time'])}</td> -->
          <td>{$item['total_ticket']}</td>  
         <!--  <td>{$item['total_money']}</td>   -->
          <!-- {$item['sort']} -->
              <td class="num{$item['id']}">
                  <span class="numspan{$item['id']}">{$item['sort']}</span>
                  <input style="display: none;" type="number" name="num{$item['id']}" class="numinp{$item['id']}" value="{$item['orderby']}" />
                  <script type="text/javascript">
                      $(function(){
                          $(".num{$item['id']}").each(function(index){
                               $(this).dblclick(function(){
                                  $(".numinp{$item['id']}").eq(index).show().focus();
                                  $(".numspan{$item['id']}").eq(index).hide();                                         
                              });
                          });
                          $(".numinp{$item['id']}").each(function(index){
                              $(this).blur(function(){       
                                  $(".numinp{$item['id']}").eq(index).hide();
                                  $(".numspan{$item['id']}").eq(index).show();
                                  var text = $(".numspan{$item['id']}").html();
                                  var inp = $(" input[ name='num{$item['id']}' ] ").val();
                                  $(".numspan{$item['id']}").html(inp);
                                  console.log(inp);
                                  id = {$item['id']};
                                  num = inp;
                                  $.ajax({
                                      type:"post",
                                      url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=UpdHd&m=zh_gjhdbm",
                                      dataType:"text",
                                      data:{activity_id:id,sort:num},
                                      success:function(data){
                                          console.log("后台传的数据:"+data);
                                      }
                                  })
                          
                              });
                          });
                      })
                  </script>          

           </td>
          {if $item['status']==1}
          <td >
            <span class="label storered">待审核</span>
          </td >
          {elseif $item['status']==2}
          <td >
            <span class="label storeblue">已通过</span>
          </td>
          {elseif $item['status']==3}
          <td >
           <span class="label storegrey">已拒绝</span>
         </td>

         {/if}
         <td>{php echo date("Y-m-d H:i:s",$item['time'])}</td>  
         <td>
          {if $item['status']==1}
          <a class="btn ygyouhui2 btn-xs" href="{php echo $this->createWebUrl('sponsoractivity',array('id'=>$item['id'],'op'=>'adopt'))}" >通过</a>
          <a class="btn storegrey2 btn-xs" href="{php echo $this->createWebUrl('sponsoractivity', array('id' => $item['id'],'op'=>'reject'))}" title="拒绝">拒绝</a>
          {/if}
          <a href="{php echo $this->createWebUrl('hdpjlist',array('id'=>$item['id']));}" class="storespan btn btn-xs">
            <span class="fa  fa-ticket"></span>
            <span class="bianji">查看活动票卷
              <span class="aritemdown"></span>
            </span>                            
          </a>
          {if $item['status']==2}
          <a href="{php echo $this->createWebUrl('bmlist',array('id'=>$item['id']));}" class="storespan btn btn-xs">
            <span class="fa fa-database"></span>
            <span class="bianji">查看报名
              <span class="aritemdown"></span>
            </span>                            
          </a>
          {/if}
          <a href="{php echo $this->createWebUrl('addsponsoractivity', array('id' => $item['id'],'hd_item'=>2))}" class="storespan btn btn-xs">
            <span class="fa fa-pencil"></span>
            <span class="bianji">编辑
              <span class="aritemdown"></span>
            </span>                            
            </a>
          <a class="storespan btn btn-xs" href="{php echo $this->createWebUrl('activity', array('id' => $item['id'],'op'=>'delete'))}" onclick="return confirm('确认删除吗？');return false;">
            <span class="fa fa-trash-o"></span>
            <span class="bianji">删除
              <span class="aritemdown"></span>
            </span>
          </a>
        </td>

      </td>

    </tr>

    {/loop}
    {if empty($list)}
    <tr class="yg5_tr2">
      <td colspan="9">
        暂无活动信息
      </td>
    </tr> 
    {/if}        
  </table>
</div>
</div>
</div>
</div>
<div class="text-right we7-margin-top">
 {$pager}
</div>
<script type="text/javascript">
  $(function(){
    $("#frame-10").show();
    $("#yframe-10").addClass("wyactive");
  })
</script>